
var popupStatus = 0;

//loading popup with jQuery magic!
function loadPopup(divId) {
	var div = "#" + divId;
	//$(div).css({"display":"block"});
	if (popupStatus == 0) {
		$(div).fadeIn("slow");
		popupStatus = 1;
	}
}

//disabling popup with jQuery magic!
function disablePopup(divId) {
	var div = "#" + divId;
	if (popupStatus == 1) {
		$(div).fadeOut("slow");
		popupStatus = 0;
	}
}

//centering popup
function centerPopup(divId) {
	var div = "#" + divId;
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $(div).height();
	var popupWidth = $(div).width();
	//centering
	$(div).css({"position":"fixed", "_position":"absolute", "top":windowHeight / 2 - popupHeight / 2, "left":windowWidth / 2 - popupWidth / 2, "z-index":2});
	//only need force for IE6
	$("#backgroundPopup").css({"height":windowHeight});
}